<%--
  Created by IntelliJ IDEA.
  User: lixiangling
  Date: 2018/7/6
  Time: 17:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../../include/layui.jsp"%>
<!DOCTYPE html>
<head>
    <%@ include file="../../include/head.jsp"%>
    <title>用户列表</title>
</head>
<body layadmin-themealias="default">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <form id="search-form">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">用户名</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" id="userName" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">号码</label>
                    <div class="layui-input-block">
                        <input type="text" name="userMobilePhone" id="userMobilePhone" placeholder="请输入号码" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <button type="button" class="layui-btn" id="search-btn"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i></button>
                    <button type="reset" class="layui-btn layui-btn-primary">清空</button>
                </div>
            </div>
            </form>
        </div>
        <div class="layui-card-body" >
            <div class="sign-text">
                <p>
                    <button class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm">
                        <i class="layui-icon">&#xe654;</i>添加
                    </button>
                    <button class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm">
                        <i class="layui-icon">&#xe642;</i>修改
                    </button>
                    <button class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm">
                        <i class="layui-icon">&#xe640;</i>删除
                    </button>
                    <button class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm">
                        <i class="layui-icon">&#xe621;</i>导出
                    </button>
                </p>
            </div>
            <div style="height: 2px"></div>
            <table class="layui-hide" id="user-table" lay-filter="user"></table>
        </div>
    </div>
</div>
<script>

    layui.use(['index','table'], function(){
        var table = layui.table;
        //方法级渲染
        table.render({
            elem: '#user-table'
            ,url:  '${ctx}/user/list'
            ,cols: [[
                {field:'id', checkbox: true, fixed: true}
                ,{field:'userName', title: '用户名'}
                ,{field:'userImageUrl', title: '会员头像',sort: true}
                ,{field:'userGender', title: '会员性别'}
                ,{field:'userMobilePhone', title: '会员电话'}
                ,{field:'mobileCarriers', title: '会员电话所属运营商', sort: true}
                ,{field:'userEmail', title: '会员邮箱', sort: true}
                ,{field:'userLevel', title: '会员等级'}
                ,{field:'registerIp', title: '注册IP', sort: true}
            ]]
            ,page: true
        });
        // 搜索按钮点事件
        $('#search-btn').on('click', function(){
            table.reload('user-table', {
                where: getParamJson('#search-form'),
                page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        });
    });

</script>
</body>
</html>
